package com.liusuai.yixian;

import com.liusuai.yixian.WebSocket.WebSocketControler;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;

@MapperScan(basePackages = {"com.liusuai.yixian.login.*"})
@SpringBootApplication
public class YixianApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(YixianApplication.class);
    }

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext
                = SpringApplication.run(YixianApplication.class, args);
        System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow","|{}");

        //解决WebSocket不能注入的问题
        WebSocketControler.setApplicationContext(applicationContext);
    }
}
